Skip to main content

substr

substr

Description

Syntax:

VARCHAR substr(VARCHAR content, INT start, INT length)

This function returns a substring of content which starts from start and is of length len. The index of the first letter is 1.

Example

mysql> select substr("Hello doris", 2, 1);
+-----------------------------+
| substr('Hello doris', 2, 1) |
+-----------------------------+
| e |
+-----------------------------+
mysql> select substr("Hello doris", 1, 2);
+-----------------------------+
| substr('Hello doris', 1, 2) |
+-----------------------------+
| He |
+-----------------------------+

Keywords

SUBSTR